package com.qst.controller;

import com.qst.pojo.Meeting;
import com.qst.service.NotificationsDetilService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author KungSu.
 * @create 2021-06-24 10:55
 */
@Controller
public class NotificationsDetilController {
    @Autowired
    private NotificationsDetilService notificationsDetilService;
    @RequestMapping("/findThisMeeting")
    public String findThisMeeting(Model model,Integer meetingid,Integer roomid){
        Meeting m = notificationsDetilService.findThisMeeting(meetingid,roomid);
        System.out.println("roomid="+m.getMeetingRoom().getRoomID());
        model.addAttribute("meeting", m);
        model.addAttribute("orderpeople",notificationsDetilService.findOrderPerson(m.getReservationistid()));
        model.addAttribute("employee", notificationsDetilService.findEmployee(meetingid));
        return "notificationsDetil";
    }
    @RequestMapping("/delThisEmployee")
    public String delThisEmployee(Model model,Integer meetingid,Integer employeeid,Integer roomid){
        notificationsDetilService.delMeetingEmployeeByMeetingId(meetingid,employeeid);
        this.findThisMeeting(model,meetingid,roomid);
        return "notificationsDetil";
    }
}
